# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer:
pkgname=libmedc
pkgver=4.1.1
pkgrel=4
pkgdesc="Open source library for numerical simulation"
url="https://www.salome-platform.org/"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake hdf5-dev swig python3-dev samurai"
options="!check" #test suite is nonfunctional with python bindings
subpackages="$pkgname-dev $pkgname-doc $pkgname-python-pyc $pkgname-python:_py"
source="
	https://files.salome-platform.org/Salome/medfile/med-$pkgver.tar.gz
	hdf5.patch
	cmake-config-dir.patch
	"
builddir="$srcdir/med-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DMEDFILE_BUILD_TESTS=OFF \
		-DMEDFILE_BUILD_PYTHON=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

_py() {
	pkgdesc="Python bindings for libmedc"
	depends="python3"
	amove usr/lib/python3*
}

sha512sums="
f211fa82750a7cc935baa3a50a55d16e40117a0f2254b482492ba8396d82781ca84960995da7a16b2b5be0b93ce76368bf4b311bb8af0e5f0243e7051c9c554c  med-4.1.1.tar.gz
68d9291e73a68d674081314028c0fce7bbd4a7b78b93b7e5078117ce62f2d07318bc33ec95091ce677148ec3926c1ce653d0760c34e74b29257a7be59210f040  hdf5.patch
8d0f58cd67d205fbacaff0e6da76e2ee5473457b478ede13a551ebe5853c0716c7406b74c3792e1ace33a34d352fccca8dd2940f063a7c060a12529d060a991a  cmake-config-dir.patch
"
